package com.siao.example.libaray.display.view
{
	import com.siao.component.BytesBitmap;
	import com.siao.component.BytesDisplayObject;
	import com.siao.display.Align;
	import com.siao.display.LayoutElement;
	import com.siao.example.common.configuration.LibarayDisplayImageConfiguration;
	import com.siao.example.common.ui.Layer;
	import com.siao.mvc.View;
	
	/**
	 * 图片视图
	 * @author SiaoLeon
	 */
	public class DisplayImageView extends View
	{
		// -------------------------------------------------------------------------------------------------------- 静态常量
		
		// -------------------------------------------------------------------------------------------------------- 静态变量
		
		// -------------------------------------------------------------------------------------------------------- 静态方法
		
		// -------------------------------------------------------------------------------------------------------- 静态函数
		
		// -------------------------------------------------------------------------------------------------------- 属性
		
		// -------------------------------------------------------------------------------------------------------- 变量
		
		/**
		 * 容器
		 */
		private var container:LayoutElement;
		
		/**
		 * 外部位图
		 */
		private var bitmap:BytesBitmap;
		
		/**
		 * 外部动态Gif
		 */
		private var dynGif:BytesBitmap;
		
		/**
		 * 外部静态Gif
		 */
		private var staGif:BytesBitmap;
		
		/**
		 * 外部位图显示对象
		 */
		private var disBitmap:BytesDisplayObject;
		
		/**
		 * 外部动态Gif显示对象
		 */
		private var disDynGif:BytesDisplayObject;
		
		/**
		 * 外部静态Gif显示对象
		 */
		private var disStaGif:BytesDisplayObject;
		
		/**
		 * 外部AS2剪辑显示对象
		 */
		private var disAS2:BytesDisplayObject;
		
		/**
		 * 外部AS3剪辑显示对象
		 */
		private var disAS3:BytesDisplayObject;
		
		// -------------------------------------------------------------------------------------------------------- 构造
		
		/**
		 * 构造函数
		 */
		public function DisplayImageView()
		{
			super();
		}
		
		// -------------------------------------------------------------------------------------------------------- 方法
		
		override public function onAdd():void
		{
			this.container = new LayoutElement();
			this.container.marginTop = 80;
			this.container.padding = 10;
			this.container.draw(0X000000, 0.2);
			Layer.instance.content.addChild(this.container);
			
			this.bitmap = new BytesBitmap();
			this.bitmap.url = LibarayDisplayImageConfiguration.BitmapPath;
			this.bitmap.x = 20;
			this.bitmap.y = 20;
			this.bitmap.width = 100;
			this.bitmap.height = 100;
			this.container.addChild(this.bitmap);
			
			this.dynGif = new BytesBitmap(LibarayDisplayImageConfiguration.DynamicGfPath);
			this.dynGif.x = 140;
			this.dynGif.y = 20;
			this.dynGif.width = 100;
			this.dynGif.height = 100;
			this.container.addChild(this.dynGif);
			
			this.staGif = new BytesBitmap();
			this.staGif.url = LibarayDisplayImageConfiguration.StaticGifPath;
			this.staGif.x = 260;
			this.staGif.y = 20;
			this.staGif.width = 100;
			this.staGif.height = 100;
			this.container.addChild(this.staGif);
			
			this.disBitmap = new BytesDisplayObject(null, true);
			this.disBitmap.name = "DisBitmap";
			this.disBitmap.url = LibarayDisplayImageConfiguration.BitmapPath;
			this.disBitmap.x = 20;
			this.disBitmap.y = 140;
			this.disBitmap.width = 100;
			this.disBitmap.height = 100;
			this.container.addChild(this.disBitmap);
			
			this.disDynGif = new BytesDisplayObject();
			this.disDynGif.url = LibarayDisplayImageConfiguration.DynamicGfPath;
			this.disDynGif.x = 140;
			this.disDynGif.y = 140;
			this.disDynGif.width = 100;
			this.disDynGif.height = 100;
			this.container.addChild(this.disDynGif);
			
			this.disStaGif = new BytesDisplayObject();
			this.disStaGif.url = LibarayDisplayImageConfiguration.StaticGifPath;
			this.disStaGif.x = 260;
			this.disStaGif.y = 140;
			this.disStaGif.width = 100;
			this.disStaGif.height = 100;
			this.container.addChild(this.disStaGif);
			
			this.disAS2 = new BytesDisplayObject();
			this.disAS2.url = LibarayDisplayImageConfiguration.As2Path;
			this.disAS2.x = 20;
			this.disAS2.y = 260;
			this.disAS2.width = 100;
			this.disAS2.height = 100;
			this.container.addChild(this.disAS2);
			
			this.disAS3 = new BytesDisplayObject();
			this.disAS3.url = LibarayDisplayImageConfiguration.As3Path;
			this.disAS3.alignH = Align.RIGHT;
			this.disAS3.alignV = Align.BOTTOM
			this.disAS3.width = 100;
			this.disAS3.height = 100;
			this.container.addChild(this.disAS3);
		}
		
		override public function onRemove():void
		{
			this.container.clear();
			this.container.remove();
			
			this.bitmap = null;
			this.dynGif = null;
			this.staGif = null;
			this.disBitmap = null;
			this.disDynGif = null;
			this.disStaGif = null;
			this.disAS2 = null;
			this.disAS3 = null;
		}
	
		// -------------------------------------------------------------------------------------------------------- 函数
	
	}
}
